home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / MacTCP / MacTCP Developer Tools / HyperCard MacTCP Toolkit 1.0 / Source Code ƒ / TCPClose.p < prev    next >
Encoding:
Text File  |  1994-11-21  |  1.2 KB  |  61 lines  |  [TEXT/MPS ]

  1. (*
  2.     TCPClose connectionID -- Close the TCP connection.
  3.  
  4.     To compile and link this file using Macintosh Programmer's Workshop,
  5.  
  6.         pascal -w TCPClose.p
  7.         link -m ENTRYPOINT -o HyperCommands -rt XCMD=7860 -sn Main=TCPClose ∂
  8.             TCPClose.p.o "{Libraries}HyperXLib.o" "{MPW}"Libraries:interface.o
  9.  
  10.     © Copyright 1988 by Apple Computer, Inc.
  11.  
  12.     Initial coding 12/88 by Harry R. Chesley.
  13. *)
  14.  
  15. {$R-}
  16.  
  17. {$S TCPClose }     { Segment name must be the same as the command name. }
  18.  
  19. unit DummyUnit;
  20.  
  21. interface
  22.  
  23. uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
  24.  
  25. procedure EntryPoint(paramPtr: XCmdPtr);
  26.     
  27. implementation
  28.  
  29. procedure TCPClose(paramPtr: XCmdPtr); forward;
  30.  
  31. procedure EntryPoint(paramPtr: XCmdPtr);
  32.  
  33.     begin
  34.         TCPClose(paramPtr);
  35.     end;
  36.  
  37. procedure TCPClose(paramPtr: XCmdPtr);
  38.  
  39.     var i: integer;
  40.  
  41.     procedure Fail(errMsg: Str255); { set theResult and quit }
  42.         begin
  43.             paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
  44.             exit(TCPClose);
  45.         end;
  46.  
  47.     {$I TCPUtil.inc}
  48.  
  49.     begin
  50.         if paramPtr^.paramCount <> 1 then Fail('§§§ parameter count is not 1 §§§');
  51.  
  52.         SetUpConnectionID;
  53.  
  54.         { Issue the close command. }
  55.         ZeroIOParms;
  56.         SyncControlBlock.csCode := TCPcsClose;
  57.         if PBControl(@SyncControlBlock,false) <> noErr then Fail('§§§ close call failed §§§');
  58.     end;
  59.  
  60. end.
  61.